const {ccclass} = cc._decorator;

type updateCallback = (detalTime: number) => void;
@ccclass
export class UpdateRegister extends cc.Component{
    private static updateCallbacks: updateCallback[] = new Array<updateCallback>;

    public static register(callback: (detalTime: number) => void){
        this.updateCallbacks.push(callback);
    }

    protected update(dt: number): void {
        UpdateRegister.updateCallbacks.forEach(element => {
            element(dt);
        });
    }
}